package com.kfm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ExController {


    @ExceptionHandler({RuntimeException.class})
    public ModelAndView doEx(){
        ModelAndView mv = new ModelAndView();
        mv.addObject("mseeage","服务器内部错误");
        mv.setViewName("error");
        return mv;
    }


    @RequestMapping("/ex")
    public String ex(){
        throw new RuntimeException("出错");
    }

}
